import {Modal, Descriptions} from 'antd';
import type {DescriptionsProps} from 'antd';

export type DetailModalProps = {
  visible: boolean;
  onVisibleChange: (visible: boolean) => void;
  values: Partial<API.IStudent>;
};

const DetailModal: React.FC<DetailModalProps> = (props) => {
  const items: DescriptionsProps['items'] = [
    {
      key: '1',
      label: '学员ID',
      children: props.values.id,
    },
    {
      key: '2',
      label: '用户ID',
      children: props.values.userId,
    },
    {
      key: '3',
      label: '报名类型',
      children: props.values.enrollmentType === 'C1' ? 'C1手动挡' :
        props.values.enrollmentType === 'C2' ? 'C2自动挡' :
          props.values.enrollmentType === 'B1' ? 'B1中型客车' : 'B2大型货车',
    },
    {
      key: '4',
      label: '学籍状态',
      children: props.values.learningStatus === "1" ? '在籍' :
        props.values.learningStatus === "2" ? '休学' :
          props.values.learningStatus === "3" ? '退学' : '毕业',
    },
    {
      key: '5',
      label: '理论成绩',
      children: props.values.theoryScore || '暂无',
    },
    {
      key: '6',
      label: '路考成绩',
      children: props.values.drivingScore || '暂无',
    },
    {
      key: '7',
      label: '付款状态',
      children: props.values.paidStatus === '0' ? '已付款' : '未付款',
    },
    {
      key: '8',
      label: '备注',
      children: props.values.remark || '无',
      span: 2,
    },
  ];

  return (
    <Modal
      title="学员详情"
      width={800}
      open={props.visible}
      onCancel={() => props.onVisibleChange(false)}
      footer={null}
    >
      <Descriptions
        bordered
        column={2}
        items={items}
      />
    </Modal>
  );
};

export default DetailModal;
